package org.fhm.zdte.server.provider;


import org.fhm.substrate.annotation.Setup;
import org.fhm.zdte.common.annotation.MapperParameter;
import org.fhm.zdte.common.annotation.Provider;
import org.fhm.zdte.common.annotation.RequestMapping;
import org.fhm.zdte.common.pojo.Result;
import org.fhm.zdte.server.ability.IGetOnlineUserGroup;

/**
 * Common servlet provider of the server side.
 *
 * @author 谭波
 * @since 2023/12/28
 */
@Provider
@RequestMapping("/common")
public class ServerCommonProvider {

    @Setup
    private IGetOnlineUserGroup iGetOnlineUserGroup;

    /**
     * Obtain all currently online user information.
     *
     * @param from The identification of client side.
     * @return Response result.
     */
    @RequestMapping("/users")
    private Result<?> obtainUserGroup(@MapperParameter("from") String from) {
        return Result.getSuccessResult(iGetOnlineUserGroup.getOnlineUserGroup(from));
    }

}
